package com.zhengsanming.mapper;

import com.zhengsanming.pojo.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface BrandMapper {
    List<Brand> selectAll();

    //    添加
    void add(Brand brand);

    //根据ID查数据
    @Select("select * from tb_brand where id =#{id};")
    @ResultMap("brandResultap")
    Brand selectByIdBrand(int id);

    //修改数据
    void update(Brand brand);

    //批量删除
    void deleteByIds(@Param("ids") int ids[]);

    //分页查询
    @Select("select * from tb_brand limit #{begin} , #{size}")
    @ResultMap("brandResultap")
    List<Brand> selectByPage(@Param("begin") int begin, @Param("size") int size);

    //总数据条数
    @Select("select count(*) from tb_brand")
    int selectTotalCount();

    /**
     * 分页条件查询
     */
    List<Brand> selectPageAndCondition(@Param("begin") int begin, @Param("size") int size, @Param("brand") Brand brand);

    /**
     * 根据条件查询总记录
     */
    int selectTotalandCondition(Brand brand);


}
